4.3 Appendix C: Control Key - TransactionStatusCallbackURL

The ControlKey form variable passed back to the merchant for the TransactionStatusCallbackURL is calculated using the following algorithm.
Values in angle brackets correspond to the values of the form variables with the name contained therein.
The format of the Controlkey for the TransactionStatusCallbackURL is "stamp:MerchantReference:transactionResultStatus"
The [Shared Encryption Key/Merchant Encryption key] value will be a key shared with the merchant from payment gateway.

private string CreateTheControlKey_TransactionStatusCallbackURL()
{
    string functionResult = string.Empty;
    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    sb.Append(string.Format("{0}:{1};", "Stamp",<Stamp>));
    sb.Append(string.Format("{0}:{1};", "Identifier",<Identifier>));
    sb.Append(string.Format("{0}:{1};", "Status",<Status>));
    functionResult = this.EncryptTheControlKey(sb.ToString(), [Shared Encryption Key]);
    return functionResult;
}


private string EncryptTheControlKey(string message, string publicKey)
{
    string functionResult = string.Empty;
    System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
    byte[] keyByte = encoding.GetBytes(publicKey);
    HMACSHA256 hmacsha256 = new HMACSHA256(keyByte);
    byte[] messageBytes = encoding.GetBytes(message);
    byte[] hashmessage = hmacsha256.ComputeHash(messageBytes);
    functionResult = ByteToString(hashmessage);
    return functionResult;
}
Figure 31. Control Key Encryption – TransactionStatusCallbackURL

Continue

Return